//
//  GoodsFooterView.m
//  团购菜单
//
//  Created by 伍银荣 on 2021/6/3.
//  Copyright © 2021 com.example. All rights reserved.
//

#import "GoodsFooterView.h"



@interface GoodsFooterView ()
@property (strong, nonatomic) IBOutlet UIButton *loadMoreBtn;
@property (strong, nonatomic) IBOutlet UIView *loadingView;


@end




@implementation GoodsFooterView
- (IBAction)loadMoreBtnClicked:(id)sender {
    self.loadMoreBtn.hidden = YES;
    self.loadingView.hidden = NO;
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        //1秒后执行这个语句
        if ([self.delegate respondsToSelector:@selector(updateDataWithGoodsFooterView:)]) {
            [self.delegate updateDataWithGoodsFooterView:self];
        }
        //执行完上面这些加载数据的方法就执行下面的方法
        self.loadMoreBtn.hidden = NO;
        self.loadingView.hidden = YES;
        
    });
}

+(instancetype)goodsFooterView {
   GoodsFooterView *footerView = [[[NSBundle mainBundle]loadNibNamed:@"GoodsFooterView" owner:nil options:nil] lastObject];
    return footerView;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
